# -*- coding: utf-8 -*-
from src.com.ydzy.util.base_util import BaserUtil
from src.com.ydzy.util.file_util import FileClient
from src.com.ydzy.util.sql_util import MySQLUtils


# INSERT INTO `audit_local`.`audit_dict` (`id`, `pid`, `type`, `code`, `content`, `describe`, `ext1`, `ext2`, `canEdit`, `status`, `createTime`, `createUser`, `updateTime`, `updateUser`, `seq`) VALUES (1231, NULL, 'z_operate_type', 'z_operate_type', '操作类型', '', '', '', '1', '1', '2024-05-31 10:01:58', NULL, NULL, NULL, NULL);

db = MySQLUtils('192.168.8.234', 3306, 'root', 'root', 'audit_dev')
base_client=BaserUtil()
file_client=FileClient()

stragetyIds=db.retrieve_sql("select id  from audit_log_strategy")
stragetyIds=[item[0] for item in stragetyIds]
print(stragetyIds)

sql=\
"""
INSERT INTO `audit_log_strategy_prem` (`id`, `strategyId`, `relId`, `parentRelId`, `relType`, `premValue`, `defaultPremValue`, `isDelete`) VALUES (0, %s, 9157, '54452', '2', 99, 99, NULL);
"""

sqls=[]
for stragetyId in stragetyIds:
    sqls.append(sql%(str(stragetyId)))

file_client.write("./a.sql","".join(sqls))
